# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-openpyxl
_pkgreal=openpyxl
pkgver=3.1.2
pkgrel=2
pkgdesc="A Python library to read/write Excel 2010 xlsx/xlsm files"
url="https://foss.heptapod.net/openpyxl/openpyxl"
arch="noarch"
license="MIT"
depends="python3 py3-lxml py3-pandas py3-pillow"
checkdepends="py3-pytest-xdist py3-tox"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://foss.heptapod.net/openpyxl/openpyxl/-/archive/$pkgver/openpyxl-$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$pkgver"

case "$CARCH" in
# several test fails on ppc64le | skip for now
ppc64le) options="$options !check" ;;
# some tests raise NotImplementedError on ARM, FIXME
aarch64|arm*) options="$options !check" ;;
esac

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -n auto
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
661045ad4aa1ce4c2493c9070dad844fa7e213156e6b19dfed9d455abb3ab1a06691e141b4b6d851fb852b3bd4c8861eb6e1bbe0108eb28835d024eee4a7aa3b  py3-openpyxl-3.1.2.tar.gz
"
